﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace pswb.Forms.ProcessEdit
{
    public partial class frmProcessFields : DockContent
    {
        public frmProcessFields()
        {
            InitializeComponent();
        }

        private void frmProcessFields_Load(object sender, EventArgs e)
        {
            //toolTip1.ToolTipTitle = "Section";
            //toolTip1.SetToolTip(linkLabel1,"Inserts a new section." + Environment.NewLine + "Sections can contain grouped fields and other items and are layed out together.");
        }

        private void linkLabel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                LinkLabel lnk = (LinkLabel)sender;
                lnk.DoDragDrop(lnk, DragDropEffects.Copy);
            }
        }

        private void linkLabel1_MouseEnter(object sender, EventArgs e)
        {
            linkLabel1.BackColor = Color.AliceBlue;
        }

        private void linkLabel1_MouseLeave(object sender, EventArgs e)
        {
            linkLabel1.BackColor = Color.Transparent;
        }

        private void linkLabel2_MouseMove_1(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                LinkLabel lnk = (LinkLabel)sender;
                lnk.DoDragDrop(lnk, DragDropEffects.Copy);
            }
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {

        }

        private void linkLabel2_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            Image dragIcon = imageList1.Images[2];

            var bmp = new Bitmap(dragIcon);

            //bmp.MakeTransparent(Color.White);
            e.UseDefaultCursors = false;
            IntPtr hIcon = bmp.GetHicon();
            Cursor.Current = new Cursor(hIcon);
            DestroyIcon(hIcon);
        }

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        extern static bool DestroyIcon(IntPtr handle);
    }
}
